/**
 * $Revision: 1.0 $
 * $Author: Eric Yang $
 * $Date: Sep 8, 2009 12:31:28 AM $
 *
 * Author: Eric Yang
 * Date  : Sep 8, 2009 12:31:28 AM
 *
 */
package com.gooex.domain.base;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 商家报价
 * 
 * @author Eric Yang
 * @version 1.0
 */
public class OrderQuote implements Serializable {
	/** PK */
	private String id;

	/** 订单供应商 */
	private OrderVendor orderVendor;

	/** 订单需求 */
	private OrderRequest orderRequest;

	/** 订单商品总价 */
	private BigDecimal amount;

	/** 订单送货/运货费用 */
	private BigDecimal carriage = new BigDecimal("0");

	/* ===========functions============================= */
	/** 获取订单总费用 */
	public BigDecimal getTotalAmount() {
		if (amount == null)
			return new BigDecimal("0");
		if (carriage == null)
			return amount;
		else
			return amount.add(carriage);
	}

	/**
	 * 是否投票过了
	 */
	public boolean hasQuoted() {
		return amount != null && carriage != null && amount.doubleValue() > 0;
	}

	/* ===========setter/getter============================= */
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public OrderVendor getOrderVendor() {
		return orderVendor;
	}

	public void setOrderVendor(OrderVendor orderVendor) {
		this.orderVendor = orderVendor;
	}

	public OrderRequest getOrderRequest() {
		return orderRequest;
	}

	public void setOrderRequest(OrderRequest orderRequest) {
		this.orderRequest = orderRequest;
	}

	public BigDecimal getAmount() {
		return amount;
	}

	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}

	public BigDecimal getCarriage() {
		return carriage;
	}

	public void setCarriage(BigDecimal carriage) {
		this.carriage = carriage;
	}

}
